<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>view/workArea/plan/planList</title>
		<!-- css代码 start -->
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<link href="../../../css/global.css" rel="stylesheet" />
		<link href="../../../css/style.css" rel="stylesheet" />
		<link href="../../../css/checkbox.css" rel="stylesheet" />
		<link href="../../../css/task.css" rel="stylesheet" />
		<style>
			.mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{
				top: 8px;
				right: -10px;
			}
			.item_box .item .text {
				height: auto;
				line-height: initial;
			}
		</style>
		<!-- css代码 end -->
	</head>
	<body>
		<!-- html代码 start -->
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">客户服务通知列表</h1>
		</header>
		<div class="mui-content">
			<!-- 没有条件查询 -->
			<!-- <div class="details_con shadow">
				<div class="clum">
					<span class="name">客户名称</span>
					<span class="txt"><input type="text" id="customerName" placeholder="请输入客户名称" /></span>
				</div>
				<div class="clum">
					<span class="name">服务类型</span>
					<span class="txt"><input type="text" id="serviceType" placeholder="请输入仪器序列号" /></span>
				</div>
				<div class="clum">
					<span class="name">仪器序列号</span>
					<span class="txt"><input type="text" id="instSn" placeholder="请输入仪器序列号" /></span>
				</div>
				<div class="btm autoHeight">
					<p class="selectBtn" onclick="selectList()"><span>查询</span></p>
				</div>
			</div> -->
			<div class="item_box" id="itemBox">
			</div>
		</div>
		<!-- html代码 end -->

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">
			var customerName = "";
			var planIds = "";
			var enginnerId = "";
			(function($, doc) {
				$.init();

				$.plusReady(function() {
					// 获取上一个页面传过来的参数并显示到页面
					var self = plus.webview.currentWebview();
					customerName = self.customerName;
					planIds = self.planIds;
					enginnerId = self.enginnerId;
					// 查询数据
					selectList();
				});
			}(mui, document));

			// 查询派单列表
			function selectList() {
				app.showWaiting('加载中...')
				ajaxPost(BASE_URL + "cc/planAndCase/planList", {
					"planIds": planIds,
					"enginnerId": enginnerId
				}, function(data) {
					app.closeWaiting()
					// console.log(JSON.stringify(data))
					if (data.code === 200) {
						// 无数据
						if (data.data.length == 0) {
							h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
							return false;
						}
						// 显示列表
						var str = '';
						for (var i = 0; i < data.data.length; i++) {
							var info = data.data[i];
							// console.log(JSON.stringify(info))
							str += '<div class="item" onclick="jumpToNext(\'' + info.serviceNo + '\',\'' + info.createTime + '\')">';
							str += '<div class="bar">';
							str += '<span class="number"><img src="../../../images/icon_204.png" />' + info.serviceNo + '</span>';
							var userTypeName = "";
							var enginnerType = info.enginnerType ? info.enginnerType : "";
							var isVip = info.isVip ? info.isVip : "";
							var userIsdpel = info.userIsdpel ? info.userIsdpel : "";
							if (userIsdpel == '1') {
								userTypeName = 'DPEL/';
							} 
							if(isVip != ""){
								userTypeName += isVip;
							}else{
								if(enginnerType != ""){
									userTypeName += enginnerType;
								}
							}
							str += '<span class="vip">'+ userTypeName +'</span>';
							str += '</div>';
							str += '<div class="type">';
							str += '<p><img src="../../../images/icon_201.png" /><span class="lpl">客户名称：</span>' + emptyStr(info.customerName) + '</p>';
							str += '<p><img src="../../../images/icon_202.png" /><span class="lpl">提交时间：</span><span>' + emptyStr(info.sendTime) + '</span></p>';
							//状态: 0待接受，1已接受，2已签到，3已签离，4已完成,5电话解决
							// 默认0待接受，1已接受，2已签到，3已签离，4已完成,5自动签离，6已拒绝    change date: 2020-07-20
							var state = "";
							if (info.state == 0) {
								state = "待接受";
							} else if (info.state == 1) {
								state = "已接受";
							} else if (info.state == 2) {
								state = "已签到";
							} else if (info.state == 3) {
								state = "已签离";
							} else if (info.state == 4) {
								state = "已完成";
							} else if (info.state == 5) {
								state = "自动签离";
							} else if (inio.state == 6) {
								state = "已拒绝";
							}
							str += '<p><img src="../../../images/icon_205.png" /><span class="lpl">状态：</span><span>' + state + '</span></p>';
							str += '<p><img src="../../../images/icon_203.png" /><span class="lpl">服务类型：</span><span>' + emptyStr(info.serviceType) + '</span></p>';
							var hopeTime = info.hopeBusinessHours;
							if (hopeTime) {
								str += '<p><img src="../../../images/icon_202.png" /><span class="lpl">期望服务时间：</span><span>' + hopeTime.substring(0, (hopeTime.length - 3)) + '</span></p>';
							} else {
								str += '<p><img src="../../../images/icon_202.png" /><span class="lpl">期望服务时间：</span><span></span></p>';
							}
							str += '</div></div>';
						}
						h('#itemBox').html(str);
					} else {
						h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
						app.toast(data.msg)
					}
				}, function(errorMsg) {
					app.closeWaiting()
					h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
					app.toast("数据获取失败，请检查网络连接");
				});
			}

			// 跳转下一页
			function jumpToNext(serviceNo, sendTime) {
				app.jumpTo("/view/workArea/service/serveDetails.html", "view/workArea/service/serveDetails", {
					serviceNo: serviceNo,
					enginnerId: enginnerId
				});
			}
		</script>
		<!-- js代码 end -->
	</body>
</html>
